﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.IO;
using System.Windows.Threading;
using System.Threading;
using System.Data;
using System.Xml.Serialization;

namespace MediaPlayer_Beta
{
    public class Librairie
    {
        public Librairie()
        {
            XmlSerializer xs = new XmlSerializer(typeof(List<Vide>));
            try
            {
                using (StreamReader rd = new StreamReader("Videos.xml"))
                {
                    lib = xs.Deserialize(rd) as List<Vide>;

                }
            }
            catch (Exception)
            {
                lib = new List<Vide>();
            }
            XmlSerializer s = new XmlSerializer(typeof(List<Musique>));
            try
            {
                using (StreamReader rd = new StreamReader("Musiques.xml"))
                {
                    Muse = s.Deserialize(rd) as List<Musique>;

                }
            }
            catch (Exception)
            {
                Muse = new List<Musique>();
            }

            XmlSerializer x = new XmlSerializer(typeof(List<Img>));
            try
            {
                using (StreamReader rd = new StreamReader("Image.xml"))
                {
                    Ims = x.Deserialize(rd) as List<Img>;
                }
            }
            catch (Exception)
            {
                Ims = new List<Img>();
            }
        }

        public int id_max = 0;
        public List<Vide> lib = new List<Vide>();
        public List<Musique> Muse = new List<Musique>();
        public List<Img> Ims = new List<Img>();
    }
}
